feat: refactored to use new endpoint SavingsGhoIncentive#2963
Open
AGMASO wants to merge 2 commits intoSDK-779-interface-incentivesfrom
Open
feat: refactored to use new endpoint SavingsGhoIncentive#2963AGMASO wants to merge 2 commits intoSDK-779-interface-incentivesfrom
AGMASO wants to merge 2 commits intoSDK-779-interface-incentivesfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors sGHO-related APR/APY fetching and UI to use the new savingsGhoIncentive GraphQL endpoint, and wires that data into the various sGHO/staking surfaces and incentive tooltips.
Changes:
- Added
useSavingsGhoIncentivehook to query the newsavingsGhoIncentiveGraphQL endpoint. - Replaced sGHO incentive displays/tooltips to use
SavingsGhoIncentivesButton(backed by the new hook). - Removed legacy
useStakeTokenAPRand relaxed filtering inuseMeritIncentives.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/modules/staking/StakingPanelNoWallet.tsx | Switches staking incentives button to the new sGHO incentives source. |
| src/modules/staking/GhoStakingPanel.tsx | Switches staking incentives button to the new sGHO incentives source. |
| src/modules/sGho/SGhoHeader.tsx | Replaces legacy APR hook usage with useSavingsGhoIncentive for header APY display and user estimates. |
| src/modules/sGho/SGhoDepositPanel.tsx | Updates “Current APY” calculation and tooltip button to use the new endpoint. |
| src/modules/reserve-overview/Gho/SavingsGho.tsx | Uses useSavingsGhoIncentive and new incentives button for Savings GHO panel. |
| src/modules/markets/Gho/GhoBanner.tsx | Updates Savings GHO banner APY display to use the new endpoint. |
| src/hooks/useStakeTokenAPR.ts | Removes the legacy adapter hook (no longer used). |
| src/hooks/useSavingsGhoIncentive.ts | Introduces the new GraphQL hook for savingsGhoIncentive. |
| src/hooks/useMeritIncentives.ts | Removes actionKey/protocolAction allowlist filtering from Merit incentives selection. |
| src/components/transactions/SavingsGho/SavingsGhoModalDepositContent.tsx | Replaces merit incentives APR sourcing with the new endpoint for modal details. |
| src/components/incentives/IncentivesButton.tsx | Adds SavingsGhoIncentivesButton and refactors Merit button rendering to reuse shared content. |
Comments suppressed due to low confidence (1)
src/hooks/useMeritIncentives.ts:166
- Removing the
actionKey→protocolActionallowlist means stake-scoped Merit campaigns (e.g.ethereum-sgho,ethereum-stkgho) can now be returned for generic supply/borrow contexts whereveruseMeritIncentivesis used (markets/dashboard/tooltips). Consider restoring this filtering (or an equivalent backend-side filter) to avoid showing stake-only campaigns in the wrong protocol context.
for (const m of merits) {
let apr = 0;
const enriched = m as unknown as EnrichedMerit;
const rewardTokenAddress = enriched.rewardTokenAddress ?? '';
const rewardTokenSymbol = enriched.rewardTokenSymbol ?? '';
if (m.__typename === 'MeritSupplyIncentive') {
apr = parseFloat(m.extraSupplyApr.formatted);
} else if (m.__typename === 'MeritBorrowIncentive') {
apr = parseFloat(m.borrowAprDiscount.formatted);
} else if (m.__typename === 'MeritBorrowAndSupplyIncentiveCondition') {
apr = parseFloat(m.extraApr.formatted);
}
if (!Number.isFinite(apr) || apr <= 0) continue;
totalMeritAPR += apr;
const actionKey = enriched.actionKey ?? '';
if (actionKey) {
activeActions.push(actionKey);
actionMessages[actionKey] = {
customMessage: enriched.customMessage ?? undefined,
customForumLink: enriched.customForumLink ?? undefined,
};
if (!firstAction) firstAction = actionKey;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
General Changes
Developer Notes
Add any notes here that may be helpful for reviewers.
Reviewer Checklist
Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate any downstream issues that may occur.
.env.examplefile as well as the pertinant.github/actions/*files